package com.tjetc.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeUtil {
    private static  String time;

    public static String timeYmd(Date date){
        //年月日
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        time = sdf.format(date);
        return time;
    }

    public static String timeYmdhm(Date date){
        //年月日，时分
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        time = sdf2.format(date);
        return time;
    }

    public static String timeYmdhms(Date date){
        //年月日，时分秒
        SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        time = sdf3.format(date);
        return time;
    }
}
